import request from '@/utils/request'
import type {
  DepartmentResponseData,
  DoctorInfoResponseData,
  DoctorSchedule,
  HospitalDetail,
  HospitalWorkData,
} from './type'

enum API {
  // 获取医院数据的接口地址
  HOSPITAL_DETAIL_URL = 'hosp/hospital/',
  // 获取医院科室的接口地址
  HOSPITAL_DEPARTMENT_URL = '/hosp/hospital/department/',
  // 获取指定医院指定科室下预约挂号信息的接口地址
  HOSPITAL_WORK_URL = '/hosp/hospital/auth/getBookingScheduleRule/',
  // 获取当天医生排班信息的接口地址
  HOSPITAL_TODAY_DOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
  // 获取挂号医生信息的接口地址
  HOSPITAL_DOCTOR_INFO_URL = '/hosp/hospital/getSchedule/',
}
// 获取医院全部数据的接口方法
export const reqHospitalDetail = (hosCode: string) =>
  request.get<any, HospitalDetail>(API.HOSPITAL_DETAIL_URL + hosCode)
// 获取医院科室的接口方法
export const reqHospitalDepartment = (hosCode: string) =>
  request.get<any, DepartmentResponseData>(
    API.HOSPITAL_DEPARTMENT_URL + hosCode,
  )
// 获取指定医院指定科室下预约挂号信息的接口方法
export const reqHospitalWork = (
  page: number,
  limit: number,
  hosCode: string,
  depCode: string,
) =>
  request.get<any, HospitalWorkData>(
    API.HOSPITAL_WORK_URL + `${page}/${limit}/${hosCode}/${depCode}`,
  )
// 获取当天医生排班信息的接口方法
export const reqDoctorSchedule = (
  hosCode: string,
  depCode: string,
  wordDate: string,
) =>
  request.get<any, DoctorSchedule>(
    API.HOSPITAL_TODAY_DOCTOR_URL + `${hosCode}/${depCode}/${wordDate}`,
  )
// 获取当前挂号医生的信息
export const reqDoctorInfo = (doctorId: string) =>
  request.get<any, DoctorInfoResponseData>(
    API.HOSPITAL_DOCTOR_INFO_URL + doctorId,
  )
